package com.njym.java.security.app.rest;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.njym.java.security.app.biz.FamilyHuiBiz;
import com.njym.java.security.app.entity.FamilyHui;
import com.njym.java.security.common.msg.TableResultResponse;
import com.njym.java.security.common.rest.BaseController;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import tk.mybatis.mapper.entity.Example;

@Controller
@RequestMapping("/familyHui")
public class FamilyHuiController extends BaseController<FamilyHuiBiz, FamilyHui> {
    @RequestMapping(value = "/list",method = RequestMethod.GET)
    @ResponseBody
    public TableResultResponse<Object> lists(@RequestParam(defaultValue = "10") int limit, @RequestParam(defaultValue = "1")int page){
        Example example = new Example(FamilyHui.class);
        example.createCriteria().andEqualTo("deleted",0);
        Page<Object> result = PageHelper.startPage(page, limit);
        baseBiz.selectByExample(example);
        return new TableResultResponse<Object>(result.getPages(),result.getResult());
    }
}
